<template>
  <div class="warp">
    <a-steps :current="current">
      <a-step title="申请合作" />
      <a-step title="秘书处审核" />
      <a-step title="合作成功" />
    </a-steps>
    <div class="content-one">
      <img class="icon" :src="infoData.apOrgLogo" alt="" />
      <span class="name">{{ infoData.apOrgName }}</span>
      <span class="post">秘书处</span>
      <span class="status">({{ apStatusMap[infoData.apStatus] }})</span>
    </div>
    <div class="content-two">
      <div class="title">向TA{{ cooperationTypeMap[infoData.cooperationType] }}</div>
      <div class="item">{{ infoData.projectName }}</div>
    </div>
    <div class="content-three">
      <div class="title">合作详情</div>
      <div class="item">
        <span>查看联系方式</span>
        <span>￥{{ infoData.priceContact }}</span>
      </div>
      <div class="item">
        <span>推广分润收入</span>
        <span>￥{{ infoData.priceContactCompute }}</span>
      </div>
      <div class="item">
        <span>秘书处撮合沟通对接</span>
        <span>￥{{ infoData.pricePeople }}</span>
      </div>
      <div class="item">
        <span>推广分润收入</span>
        <span>￥{{ infoData.pricePeopleCompute }}</span>
      </div>
      <div class="item">
        <span>发起申请时间</span>
        <span>{{ infoData.createTime }}</span>
      </div>
    </div>
    <ApplyModal ref="applyModal" @success="getCooperationDetail" />
    <CancelModal ref="cancelModal" @success="getCooperationDetail" />
  </div>
</template>

<script>
import OrganInfo from '../components/organInfo.vue'
import Item from '../components/item.vue'
import PriceConfigModal from '../components/priceConfigModal.vue'
import ApplyModal from './modal/apply.vue'
import CancelModal from './modal/cancel.vue'
import { apStatusMap, cooperationTypeMap, CooperationDetail } from '@/api/business/cooperation'
import Vue from 'vue'
import { TENANTID } from '@/store/mutation-types'
export default {
  components: {
    OrganInfo,
    Item,
    PriceConfigModal,
    CancelModal,
    ApplyModal,
  },
  data() {
    return {
      apStatusMap,
      cooperationTypeMap,
      infoData: {},
      applyRow: {},
      current: 0,
      tenantId: Vue.ls.get(TENANTID),
    }
  },
  methods: {
    async getCooperationDetail() {
      let res = await CooperationDetail({ id: this.applyRow.id })
      this.infoData = res.data
      let { apStatus } = this.infoData
      if (apStatus === 1) this.current = 1
      else if (apStatus === 2) this.current = -1
      else if (apStatus === 3) this.current = 2
    },
    handleApply() {
      this.$refs.applyModal.show(this.applyRow.id)
    },
    handleCancel() {
      this.$refs.cancelModal.show(this.applyRow.id)
    },
  },
  created() {
    this.applyRow = JSON.parse(this.$route.query.data)
    this.getCooperationDetail()
  },
}
</script>

<style lang="less" scoped>
.warp {
  background: #fff;
  padding: 20px;
  border-radius: 20px;
  .content-one {
    display: flex;
    align-items: center;
    padding: 20px;
    .icon {
      width: 50px;
      height: 50px;
      border-radius: 50%;
    }
    .name,
    .post {
      font-size: 16px;
      font-weight: bold;
      margin-left: 10px;
    }
    .status {
      font-size: 16px;
      color: red;
      margin-left: 50px;
      font-weight: bold;
    }
  }
  .content-two,
  .content-three {
    margin-top: 20px;
    width: 500px;
    .title {
      font-size: 18px;
      font-weight: bold;
      padding: 10px;
      border-bottom: 1px #eee solid;
    }
    .item {
      padding: 10px;
      display: flex;
      justify-content: space-between;
      font-size: 16px;
    }
  }
  .btn {
    margin: 30px 0;
    text-align: center;
  }
}
</style>